﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[spMonitor_PrunePerfmon]
#-- Purpose:		Prunes old performance monitor data
#--	Last Update:	08/05/2012
#--					For a complete history - please review comments in Version
#--					Control.
#-- Called By:		Scheduled Job
#------------------------------------------------------------------------------
*/
CREATE PROCEDURE [dbo].[spMonitor_PrunePerfmon]
(
	@detail_months	int		= 1,
	@hourly_months	int		= 3
)
AS

SET NOCOUNT ON

DELETE FROM [dbo].[tblMonitor_Perfmon] WHERE date_inserted < DATEADD(month, (-1 * @detail_months), GETDATE())
DELETE FROM [dbo].[tblMonitor_PerfmonHourlySummary] WHERE date_inserted < DATEADD(month, (-1 * @hourly_months), GETDATE())

SET NOCOUNT OFF